/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Logic;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author TuxCompany
 */
public class Conectividad {
    
    public static Connection Conector;
    public static String U_DB, P_DB;
    
    
    public Conectividad() {
    }
    
    public static void Conectar(String U, String P) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Conector = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/CE_MANI", U, P);
        } catch (SQLException ex) {
           MessageBox.show("ERROR","No se logro establecer conexion\nConsulte a su administrador de RED\n"+ex.getMessage(),MessageBox.Error);
           Exit.Ok();
            //Logger.getLogger(conexion.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            //Logger.getLogger(conexion.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            if (Conector.isClosed()) {
                MessageBox.show("Error", "No se logro establecer conexion\nConsulte a su administrador de RED", MessageBox.Informacion);
                Exit.Ok();
            }
        } catch (SQLException ex) {
            //Logger.getLogger(conexion.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
